package com.lanou.tk.tourism.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by dllo on 15/10/23.
 */
public class MainActivityAdapter extends FragmentPagerAdapter{

    private List<Fragment> list_fragment;   //定义fragment列表
    private List<String> list_title;        //定义tab列表


    public MainActivityAdapter(FragmentManager fm, List<Fragment> list_fragment, List<String> list_title) {
        super(fm);
        this.list_fragment = list_fragment;
        this.list_title = list_title;
    }

    @Override
    public Fragment getItem(int position) {

        return list_fragment.get(position);
    }


    @Override
    public int getCount() {

        return list_title.size();
    }
    public CharSequence getPageTitle(int position){
        return list_title.get(position % list_title.size());
    }
}
